<script setup lang="ts">
import {defineExpose, defineProps, reactive, ref} from "vue";
import {
  AddChapter,
  GetSecretKeyList,
  GetTextContent,
  GetTextList
} from "../../../../wailsjs/go/view/SecretText";
import {base} from "../../../../wailsjs/go/models.ts";

const dialogVisible = ref(false)
const addForm = reactive({
  textId:"",
  title: "",
  content: "",
})

const clickSubBtn = ()=>{
  console.log(addForm)
  AddChapter(addForm.textId,addForm.title,addForm.content).then(()=>{
    dialogVisible.value = false
  })
}


defineExpose({
  dialogVisible,
  addForm
})
</script>

<template>
  <el-dialog v-model="dialogVisible" >
    <el-form :model="addForm" label-width="auto" >
      <el-form-item label="标题">
        <el-input v-model="addForm.title" />
      </el-form-item>
      <el-form-item label="内容">
        <el-input v-model="addForm.content" type="textarea" :rows="6"/>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogVisible =false">取消</el-button>
        <el-button type="primary" @click="clickSubBtn">提交</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<style scoped lang="scss">

</style>
